package com.xy.biz.base.domain.converter;

import com.xy.biz.base.domain.bo.BomGoodsBO;
import com.xy.biz.base.domain.po.BomGoodsPO;
import com.xy.biz.base.domain.req.SaveBomGoodsRequest;
import com.xy.biz.base.domain.resp.GetBomGoodsResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 *
 *
 * @author zsp
 * @date 2021-12-28
 */
public class BomGoodsConverter {

	public static BomGoodsPO toPO(BomGoodsBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new BomGoodsPO(), true);
	}

	public static List<BomGoodsPO> toPO(Collection<BomGoodsBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new BomGoodsPO(), true);
	}

	public static BomGoodsBO fromPO(BomGoodsPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new BomGoodsBO());
	}

	public static List<BomGoodsBO> fromPO(Collection<BomGoodsPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new BomGoodsBO());
	}

	public static BomGoodsBO toBO(SaveBomGoodsRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new BomGoodsBO(), true);
	}

	public static List<BomGoodsBO> toBO(Collection<SaveBomGoodsRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new BomGoodsBO(), true);
	}

	public static GetBomGoodsResponse toResponse(BomGoodsBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetBomGoodsResponse());
	}

	public static List<GetBomGoodsResponse> toResponse(Collection<BomGoodsBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetBomGoodsResponse());
	}

}
